package com.xatu.yl.storeshopping.activity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;


import com.example.namespace.R;

/**
 * Created by Administrator on 2018/4/21.
 */

public class MenuAvtivity extends AppCompatActivity {

    //menu操作
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.menu_history) {
//            Intent intent = new Intent();
//            intent.setClass(this, HistoryListActivity.class);
//            startActivity(intent);
            return true;
        }
        if (id == R.id.menu_about) {
            Intent intent = new Intent();
            intent.setClass(this, AboutActivity.class);
            startActivity(intent);
            return true;
        }
        if (id == R.id.menu_exit) {
            System.exit(0);
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
    //menu操作
}
